<?php // no direct access
defined('_JEXEC') or die('Restricted access'); ?>
<script src="templates/cafe/jquery.validate.js" type="text/javascript"></script>
<script language="javascript">
function setUsername(username){
	$("#username").val(username);
}
jQuery(document).ready(function(jQuery) {
   	jQuery("#userForm").validate(
		{				 
			errorPlacement: function(error, element) {			
		},
		invalidHandler: function(form, validator) {
			var errors = validator.numberOfInvalids();
			if (errors) {
				jQuery('#alert').html(validator['errorList'][0]['message']);
				jQuery('#backoverlay').show();
				jQuery('#show_popup').show();
				jQuery('#f_focus').html(validator['errorList'][0]['element'].id);
				validator['errorList'][0]['element'].focus();
		  	}
		},
		rules: {
			email: {
				required: true,
				email: true
			},
			
			company : "required",
			name : "required",
			address : "required",
			post : "required",
			city : "required",
			cvr : "required",
			phone : "required"
		},
		messages: {
			email: "Indtast venligst korrekt e-mail",
			company: "Indtast venligst virksomhed / institution",
			name: "Indtast venligst kontaktperson",
			address: "Indtast venligst adresse",
			post: "Indtast venligst Postnr",
			city: "Indtast venligst by",
			cvr: "Indtast venligst CVR-nr",
			phone: "Indtast venligst telefon"
		}
		
	});
	close_popup=function(){		
		var fel=jQuery('#f_focus').html();
		jQuery('#backoverlay').hide();
		jQuery('#show_popup').hide();
		jQuery('#' + fel ).focus();			
	};
});
</script>
<div class="main-content clear-fix" id="shopcart-page">
    <div class="content-left">						
        <div id="order-list-2">
            <ul class="main-order-list">
                <li><a href="index.php?option=com_user&view=user&layout=myprofile&Itemid=19">Mine profil</a></li>						
                <li><a class="activeCate" href="index.php?option=com_user&view=user&layout=form&Itemid=19">Profil &amp; Betaling</a></li>
            </ul>
        </div>	
    </div>
    <form action="<?php echo JRoute::_( 'index.php' ); ?>" method="post" name="userForm" id="userForm" autocomplete="off" class="form-validate">
    <div class="content-right" id="order-right">
        <div class="form-register">
            <div class="heading">
                <h2>Ny bruger</h2>
            </div>
            <div class="input-block">
                <label for="email">E-mail <span class="red">*</span></label>
                <input type="text" value="<?php echo $this->escape($this->user->get('email'));?>" id="email" name="email" disabled="disabled" />
            </div>
            <div class="input-block">
                <label for="password">Password</label>
                <input type="password" value="" name="password" id="password" />
            </div>
            <div class="input-block" id="input-last">
                <label for="password">Gentag password</label>
                <input type="password" value="" id="password2" name="password2"/>
            </div>
            <div class="heading">
                <h2>Firma/Institution</h2>
            </div>
            <div class="input-block">
                <label for="Name">Firma/Institution <span class="red">*</span></label>
                <input type="text" id="company" name="company" value="<?php echo $this->info->company;?>" />
            </div>
            <div class="input-block">
                <label for="email">Kontaktperson <span class="red">*</span></label>
                <input type="text" name="name" id="name" value="<?php echo $this->escape($this->user->get('name'));?>" />
            </div>
            <div class="input-block">
                <label for="email">Adresse <span class="red">*</span></label>
                <input type="text" id="address" name="address" value="<?php echo $this->info->address;?>" />
            </div>
            <div class="input-block clear-fix">
                <div class="input-block-left">
                    <label for="Postnr ">Postnr <span class="red">*</span></label>
                    <input type="text" id="post" name="post" value="<?php echo $this->info->post;?>" />
                </div>
                <div class="input-block-right">
                    <label for="by">By <span class="red">*</span></label>
                    <input type="text" id="city" name="city" value="<?php echo $this->info->city;?>" />
                </div>						
            </div>
            <div class="input-block">
                <label for="email">CVR-nr <span class="red">*</span></label>
                <input type="text" id="cvr" name="cvr" value="<?php echo $this->info->cvr;?>" />
            </div>
            <div class="input-block">
                <label for="email">Telefon/mobil <span class="red">*</span></label>
                <input type="text" id="phone" name="phone" value="<?php echo $this->info->phone;?>" />
            </div>
            <div class="input-submit clear-fix">
                <a id="btn-save" onclick="jQuery('#userForm').submit();">Save</a>						
            </div>
        </div>               
    </div>
    <input type="hidden" name="username" value="<?php echo $this->user->get('username');?>" />
	<input type="hidden" name="id" value="<?php echo $this->user->get('id');?>" />
	<input type="hidden" name="gid" value="<?php echo $this->user->get('gid');?>" />
	<input type="hidden" name="option" value="com_user" />
	<input type="hidden" name="task" value="save" />
	<?php echo JHTML::_( 'form.token' ); ?>
</form>		
</div>